< previous page page_135 next page >

Page 135
Procedure to create the Public property Text, enter the code from Listing 5.17 into the corresponding Let and Get routines for the Text property.
Type.gifListing 5.17. Coding the Text property Let and Get routines.
Public Property Get Text() As Variant
    Text = Text1.Text
End Property

Public Property Let Text(ByVal vNewValue As Variant)
    Text1.Text = vNewValue
End Property
Finally, you need to set the attributes of this property so that it can be used within database forms. Select Tools | Procedure Attributes to bring up the attributes dialog.
Select the Text property, select the Advanced button, and place a check mark in all the Data Bindings fields at the bottom of the form. This adds the DataField and DataSource properties to the VText control (see Figure 5.12).
0135-01.jpg
Figure 5.12.
Setting the Data Bindings
of a custom property.
There is one more set of routines you need to code before your property handling is complete. You need to add code to the WriteProperties and ReadProperties events of the UserControl. This code is executed each time the control moves from design time to runtime. Listing 5.18 shows the code for the WriteProperties event. Add this to your UserControl modules.

 
< previous page page_135 next page >

If you like this book, buy it!